

/**
 * @author Charles Huang <br>
 * Captain Miller is a hardened veteran, one of the few who can remember
 * a time when it was men of flesh and blood who fought on the battlefield
 * rather than men of steel and wires. His only complaint about the new
 * mechanical warriors has been their lack of a fighting spirit, and as such,
 * he learned how to program fighting spirit into his robot infantry, and soon
 * patented Attack Programming v.1.1. As such, his BattleBots have the fighting
 * spirit that Miller wanted to see in his men, and are significantly more
 * capable against enemy vehicles. To compliment attack programming, he also
 * developed Defense Programming, currently at v. 0.7, which significantly
 * increases the defensive capabilities of infantry for a short time.
 */
public class CaptainMiller extends Commander
{
	public CaptainMiller()
	{
		super("Captain Miller", 2000, 0, 1.0, 1.2);
	}
	/**
	 * @return attackMod - returns multiplier for damage dealt, a number > 1 <br>
	 * is a bonus, a number < 1 is a penalty, and 1 is no change
	 * Captain Miller's infantry get a 20% attack bonus against vehicles
	 * @param Attacker - the attacking unit
	 * @param Target - the defending unit
	 */
	public double getAttackMod(Unit Attacker, Unit Target)
	{
		if(Attacker instanceof Infantry && Target instanceof Vehicle)
		{
			return super.getAttackMod(Attacker, Target);
		}
			return 1.0;
	}
	/**
	 * @param Target - the defending unit
	 * @param Attacker - the attacking unit
	 * Captain Miller's infantry get a 40% defensive boost when power is activated
	 * @return defenseMod - returns multiplier for damage received, a number < 1 <br>
	 * is a bonus, > 1 is a penalty, and 1 is no change
	 */
	public double getDefenseMod(Unit Target, Unit Attacker)
	{
		if(super.getPower() && Target instanceof Infantry)
		{
			return getDefenseMod(Attacker, Target);
		}
		return 1.0;
	}
	/**
	 * Captain Miller's power gives a 40% defensive boost to infantry
	 */
	public void activatePower()
	{
		super.activatePower();
		setDefenseMod(0.6);
	}
	
	public void deactivatePower()
	{
		super.deactivatePower();
		setDefenseMod(1.0);
	}
}
